﻿Public Class SalaryAdd

    Private Sub btnok_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnok.Click
        If txtsalary.Text.Trim = "" Then
            MessageBox.Show("ប្រាក់ខែមិនអាចទទេបានទេ")
            Exit Sub
        End If
        If Validator.IsInteger(txtsalary.Text) = False Then
            MessageBox.Show("សូមបញ្ចូលប្រាក់ខែជាលេងគ្មានក្បៀស")
            Exit Sub
        End If
        cmdp.Parameters("@EmpId") = cboemp.SelectedValue
        cmdp.Parameters("@Salary") = txtsalary.Text
        cmdp.ExecuteNonQuery("INSERT INTO [Salary] (EmpId,BaseSalary,Active) Values(@EmpId,@Salary,true)")
        MessageBox.Show("បញ្ចូលប្រាក់ខែបានជោគជ័យ")
    End Sub

    Private Sub SalaryAdd_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        loademp()
    End Sub
    Private Sub loademp()
        cboemp.DisplayMember = "EmpName"
        cboemp.ValueMember = "EmpId"
        cboemp.DataSource = cmdp.ExecuteDataTable("SELECT EmpName,EmpId FROM Employee WHERE Active=true")
    End Sub
End Class